const path = require("path");
const Help = require("./help.js");
const fs = require("fs");
async function  main(){
  let dom_4band_dir="W:/lis_produce/66e79fe520bfe3edc182b52d/dom1"
  let dom_3band_savedir="W:/lis_produce/66e79fe520bfe3edc182b52d/convert"
  let url_convert="http://172.16.102.40:9300/api/add_convert?"
  let tifs=Help.Get_Deep_Files(dom_4band_dir,[".tif"],false)
  for (let i = 0; i < tifs?.length; i++) {
    let one_tif = tifs[i];
    let one_tif_file = one_tif?.file;
    let status_task=await Help.Request_Get_Common(url_convert,{
      src:one_tif_file,
      savedir:dom_3band_savedir,
      inbands:"0,1,2",
      outbands:"2,1,0",
      do_ovr:1,
      do_cog:0,
      do_upload:0,
      priority:80
    },0)
    console.log(status_task)
  }
  return true
}
async function  main(){
  let dom_4band_dir="W:/google_5w/merge_tf_tifs_ok"
  let url_convert="http://172.16.102.40:9300/api/add_ovr?"
  let tifs=Help.Get_Deep_Files(dom_4band_dir,[".tif"],false)
  for (let i = 0; i < tifs?.length; i++) {
    let one_tif = tifs[i];
    let one_tif_file = one_tif?.file;
    let status_task=await Help.Request_Get_Common(url_convert,{
      src:one_tif_file,
      do_cog:0,
      do_upload:0,
      priority:80
    },0)
    console.log(status_task)
  }
  return true
}
main().then(()=>{
  console.log(`done...`)
})